#include <iostream>

using namespace std;

int main()
{
	int count;
	unsigned long sum = 0;

	for (count = 0; count < 1000; count++)
	{
		if (count % 3 == 0 || count % 5 == 0)
		{
			sum += count;
		}
	}

	cout << sum << endl;
}